import { deleteJSON, getJSON, putJSON } from "./request";

export default {
  passComment(
    commentID: number,
    notifyPublisher: boolean = false,
    notifyParentCommeter: boolean = false,
  ) {
    return putJSON(
      `/api/admin/article/comment/pass/${commentID}?notifyPublisher=${notifyPublisher}&notifyParentCommeter=${notifyParentCommeter}`,
    );
  },
  rejectComment(commentID: number) {
    return putJSON("/api/admin/article/comment/reject/" + commentID);
  },

  deleteArticleCommentByID(commentID: number) {
    return deleteJSON("/api/admin/article/comment/" + commentID);
  },

  getArticleCommentCount(
    commentState: "all" | "reviewing" | "pass" | "reject",
  ) {
    return getJSON(
      `/api/admin/article/comment${commentState === "all" ? "" : "/" + commentState}/count`,
    );
  },
  getArticleCommentsByPage(
    commentState: "all" | "reviewing" | "pass" | "reject",
    page: number,
    pageSize: number = 10,
  ) {
    return getJSON(
      `/api/admin/article/comment${commentState === "all" ? "" : "/" + commentState}/page/${page}?size=${pageSize}`,
    );
  },
};
